using UnityEngine;
using System.Collections;

public class Lever : MonoBehaviour 
{
	public GameObject objectAttached;
	public Function objectDisabled;
	
	public void run()
	{
		switch(objectDisabled)
		{
		case Function.PLATAFORM:
			objectAttached.GetComponent<MovePlataform>().enabled = false;
			break;
		case Function.DOOR:
			gameObject.SendMessage("receivedDoor",SendMessageOptions.DontRequireReceiver);
			
			break;
		case Function.TOWER:
			objectAttached.GetComponent<Tower>().enabled = false;
				break;
			
		}
		Destroy(gameObject.GetComponent<BoxCollider>());
		Destroy(objectAttached.GetComponent<BoxCollider>());
		gameObject.AddComponent("DoorDestroy");
		gameObject.GetComponent<DoorDestroy>().amount = 1f;
		objectAttached.AddComponent("DoorDestroy");
		objectAttached.GetComponent<DoorDestroy>().amount = 1f;
	}
	
	public enum Function
	{
		PLATAFORM,
		DOOR,
		TOWER
	}
	
	
}
